<template>
  <div>
    <div>
      <!-- {{ meslist }} -->
      <el-button @click="dialogFormVisible = true">添加</el-button>
      <el-dialog title="添加工作流" :visible.sync="dialogFormVisible">
        <el-form :model="form">
          <el-form-item label="活动名称" :label-width="formLabelWidth">
            <el-input v-model="form.name" autocomplete="off"></el-input>
          </el-form-item>
        </el-form>

        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取 消</el-button>
          <el-button type="primary" @click="addworkflow">确 定</el-button>
        </div>
      </el-dialog>
    </div>
    <div>
      <el-table :data="meslist" style="width: 100%">
        <el-table-column prop="name" label="内容" width="180">
        </el-table-column>
        <el-table-column prop="params" label="详情" width="180">
        </el-table-column>
        <el-table-column fixed="left" label="操作" width="100">
          <template slot-scope="scope">
            <el-button
              @click="handleClick(scope.row.id)"
              type="text"
              size="small"
              >添加流程</el-button
            >
            <el-button @click="add(scope.row.id)" type="text" size="small"
              >配置流程</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>
  
  <script>
export default {
  data() {
    return {
      dialogFormVisible: false,
      formLabelWidth: "120px",
      form: {
        name: "",
      },
      meslist: [],
    };
  },
  methods: {
    addworkflow() {
      this.axios.post("/setwork", this.form).then((res) => {
        if (res.data.code == 200) {
          this.dialogFormVisible = false;
        }
      });
    },
    getflow() {
      this.axios.get("/getwork").then((res) => {
        // console.log(res)
        this.meslist = res.data.msg;
      });
    },
    handleClick(id) {
      this.$router.push({ name: "Setparams", params: { id: id } });
    },
    add(id) {
      this.$router.push({ name: "Showform", params: { id: id } });
    },
  },
  mounted() {
    this.getflow();
  },
};
</script>
  
  <style>
</style>